package practice3;

import java.util.Scanner;
/**
 * 前缀和
 */
public class P8772 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans=0;
        long sum=0;
        for (int i = 1; i <= n; i++) {
            int a=sc.nextInt();
            ans+=a*sum;
            sum+=a;
        }
        System.out.println(ans);
    }
}
